<!DOCTYPE html>
<html>
<head>
    <title></title>
    <% include ../include/css_header.html %>
    <style>
        .haohouhu{
            height: 100px;
            position: absolute;
            right: 10px;
            top: 30px;
        }
        .gui-pic{
            bottom: 40px;
            height: 100px;
            position: absolute;
            right: 20px;
        }
        .jumbotron p{
            color: #999999;
            font-size: 18px;
        }
    </style>
</head>
<body class="actlist_bg" style="min-height: 640px;">
    <div class="container">
        <div style="height: 20px;"></div>
        <div class="row">
            <div class="col-xs-12">
                <div class="jumbotron" style="position: relative;background-color: #ffffff">
                    <h1>求打赏，<br>求带走~</h1>
                    <p>长亭外，古道边，芳草天；
                        天之涯，地之角，盼壕来~</p>
                    <img src="/haoyouhu.jpg" class="haohouhu">
                </div>
            </div>
        </div>
        <div class="row" style="text-align: center">
             <span class="icon-arrow-down"  style="color: #ffffff;font-size: 30px;"></span>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="jumbotron" style="background-color: #ffffff;">
                    <h3>赏程猿员一杯下午茶<img width="24" height="24" src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/60.gif"></h3>
                    <p>不犯困，工作带劲儿~</p>
                    <p>
                        <a href="javascript:createAndPayOrder(22);" class="btn btn-warning btn-lg" style="width: 150px;">￥ 22</a>
                    </p>
                    <img src="/guiqiu.jpg" class="gui-pic">
                </div>
            </div>
        </div>
        <div class="row" style="text-align: center">
            <span class="icon-arrow-down"  style="color: #ffffff;font-size: 30px;"></span>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="jumbotron" style="background-color: #ffffff;">
                    <h3>赏程猿员一顿加班餐<img width="24" height="24" src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/61.gif"></h3>
                    <p>吃点儿好滴晚上加班继续服务壕~</p>
                    <p>
                        <a href="javascript:createAndPayOrder(222);" class="btn btn-warning btn-lg" style="width: 150px;">￥ 222</a>
                    </p>
                    <img src="/guiqiu.jpg" class="gui-pic">
                </div>
            </div>
        </div>
        <div class="row" style="text-align: center">
            <span class="icon-arrow-down"  style="color: #ffffff;font-size: 30px;"></span>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="jumbotron" style="background-color: #ffffff;">
                    <h3>赏程猿员过年回家机票<img width="24" height="24" src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/69.gif"></h3>
                    <p>不分心刷票、工作到年三十儿~</p>
                    <p>
                        <a href="javascript:createAndPayOrder(2222);" class="btn btn-warning btn-lg" style="width: 150px;">￥ 2222</a>
                    </p>
                    <img src="/guiqiu.jpg" class="gui-pic">
                </div>
            </div>
        </div>
        <div class="row" style="text-align: center">
            <span class="icon-arrow-down"  style="color: #ffffff;font-size: 30px;"></span>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="jumbotron" style="background-color: #ffffff;">
                    <h3>帮女博士凑嫁妆<img width="24" height="24" src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/77.gif"></h3>
                    <p>加班有底气，时时牵挂壕~</p>
                    <p>
                        <a href="javascript:createAndPayOrder(22222);" class="btn btn-warning btn-lg" style="width: 150px;">￥ 22222</a>
                    </p>
                    <img src="/guiqiu.jpg" class="gui-pic">
                </div>
            </div>
        </div>
        <div class="row" style="text-align: center">
            <span class="icon-arrow-down"  style="color: #ffffff;font-size: 30px;"></span>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="jumbotron" style="background-color: #ffffff;">
                    <h3>有钱，就是任性！<img width="24" height="24" src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/4.gif"></h3>
                    <p>赏程序猿过年度假去吧，表加班啦~</p>
                    <p>
                        <input type="text" id="cusPay" value="" style="width: 150px;margin-bottom: 10px;display: none" placeholder="求赏大洋~"/>
                        <a href="javascript:customOrder();" class="btn btn-warning btn-lg" style="width: 150px;">￥ ?????</a>
                    </p>
                    <img src="/guiqiu.jpg" class="gui-pic">
                </div>
            </div>
        </div>
        <% include ../include/copyright.html %>
    </div>
    <% include ../include/js_footer.html %>
    <script>
        var shareData = {
            img_url: 'http://wechatjh.fourjoy.net/guiqiu.jpg',
            link: siteGlobal.SITE_HOST+'/dashang/',
            title: '年根儿了，程序猿跪求土豪打赏~ ',
            desc:'长亭外，古道边，芳草天，谢谢你让我跪着把钱赚了~'
        }
        $(function(){
            WeixinUtil.initConfig(['onMenuShareTimeline', 'onMenuShareAppMessage'], true, function(){
                WeixinUtil.sharePage(shareData.title, shareData.desc, shareData.img_url, shareData.link)
            })
        })
        function customOrder(){
            $('#cusPay').fadeIn();
            var pay = $.trim($('#cusPay').val());
            if(/^[0-9]*[1-9][0-9]*$/.test(pay)){
                createAndPayOrder(pay);
            }else{
                $('#cusPay').focus();
                AlertBox.showTip('壕，多赏点儿吧~')
            }
        }
        function createAndPayOrder(fee){
            AlertBox.showTip('<img src="/loading.gif" style="height: 20px;"/>', true)
            _preWechatPay(fee, function(order, jsapi_params){
                _createOrder(order, function(){
                    AlertBox.hideTip();
                    WeixinJSBridge.invoke('getBrandWCPayRequest', {
                        'appId': jsapi_params.appId,
                        'timeStamp': jsapi_params.timeStamp,
                        'nonceStr': jsapi_params.nonceStr,
                        'package': jsapi_params.package,
                        'signType': 'MD5',
                        'paySign': jsapi_params.paySign
                    }, function(res){
                        //alert(res.err_code+res.err_desc+res.err_msg);
                        if(res.err_msg == 'get_brand_wcpay_request:ok'){
                            //TODO:跳转成功页面
                            window.location.href = '/tuhaolist/'+order.id
                        }else{
                            AlertBox.showTip('土豪，赏点大洋吧...')
                        }
                    })
                })
            })
        }
        function _preWechatPay(fee, cb){
            $.getJSON('/wxpay/jsapi/payorder/'+fee, function(res){
                cb(res.order, res.jsapi_params)
            })
        }
        function _createOrder(order, cb){
            $.post('/createOrder', {
                factionId: '5410286a7c99781e517c7d65',
                tradeNo: order.tradeNo,
                totalFee: order.totalFee,
                goodsId: '5487ecf3b50a30cf5e9cf760',
                goodsName: '打赏'
                //address: address
            }, function(err, data){
                cb(err, data);
            })
        }
    </script>
</body>
</html>